<!--
 描述: 登录模板
 作者: Hanyue
 日期: 2021-06-10
-->

<template>
  <div class="login-container">
  	<div class="layer">
  			<div class="some-space">
        	<div class="form">
						<h2><span>项目展示</span>云平台</h2>
						<div class="item">
							<i class="iconfont icon-user"></i>
							<input
	              autocomplete="off"
	              type="text"
	              class="input"
	              v-model="userName"
	              placeholder="请输入用户名"
	            />
            </div>
            <div class="item">
            	<i class="iconfont icon-password"></i>
	            <input
	              autocomplete="off"
	              type="password"
	              class="input"
	              v-model="userPwd"
	              maxlength="20"
	              @keyup.enter="login"
	              placeholder="请输入密码"
	            />
            </div>
	          <button 
	            class="loginBtn"
	            :disabled="isLoginAble"
	            @click.stop="login">
	            立即登录
	          </button>
	          <div class="tip">
							默认用户名：admin ，默认密码：abc123
	          </div>
        	</div>
        </div>
        <div class="pic"><img src="@/assets/img/login/pic.png"></div>

    </div>


  </div>
</template>

<script>

export default {
  name: 'Login',
  components: {},
  data() {
  	return {
  		userName: '',
  		userPwd: '',
      visible: false,
      modalContent: '这是一段自定义模态框消息'
  	}
  },
  computed: {
  	isLoginAble() {
  		return !(this.userName && this.userPwd);
  	}
  },
  created() {},
  mounted() {

  },
  methods: {
  	login () {
  		if (this.userName == 'admin' && this.userPwd == 'abc123') {
         this.$router.push({
          path: '/main'
         })
      } else {
          console.log(this.userName);
          this.$message({
            showClose: true,
            message: '请输入正确的用户名和密码',
            type: 'error'
          });
 
      }
  	},

  }
}
</script>

<style lang="scss" scoped>
button:disabled {
  opacity:.6;
  pointer-events:none;
}

.login-container {
	.layer {
	  position: absolute;
	  height: 100%;
	  width: 100%;
	  background: url(~@/assets/img/login/bg.jpg) no-repeat;
	  background-size:cover;
	}
	#particles-js {
	  position: absolute;
	  top: 0;
	  left: 0;
	  width: 100%;
	  height: 100%;
    z-index: 1000;
	}
	.some-space {
	  color: white;
	  font-weight: 100;
	  letter-spacing: 2px;
	  position: absolute;
	  top: 50%;
	  left: 34%;
	  z-index: 1001;
	  -webkit-transform: translate3d(-50%, -50%, 0);
	  transform: translate3d(-50%, -50%, 0);



	  .form {
	  	width: 440px;
	  	height: auto;
	  	padding: 35px 30px 25px;
	    .item {
	    	display: flex;
	    	align-items: center;
				margin-bottom: 25px;
        background: #f3f6fb;
        padding-left: 20px;
        border-radius: 4px;
				i {
					color: #7e8a99;
					margin-right: 10px;
				}
	    }
	  	h2 {
	  		text-align: center;
	  		font-weight: normal;
	  		font-size: 24px;
	  		color: #222;
	  		padding-bottom: 35px;
        span{
          font-size:32px;
          color:#44caa9;
        }
	  	}
	  	.input {
        font-size: 16px;
        line-height: 30px;
        width: 100%;
        color: #7e8a99;
        outline: none;
        border: none;
        background-color: rgba(0, 0, 0, 0);
        padding: 10px 0;
	  	}
	  	.loginBtn {
	  		width: 100%;
	  		padding: 12px 0;
        font-size: 16px;
        background:#44caa9;
        border:0;
    		color: #fff;
    		cursor: pointer;
    		border-radius: 4px;
        margin-top: 10px;
    		&:hover {
    			color: #fff;
    			background: #55dab9;
    		}
	  	}
	  	.tip {
        font-size: 12px;
        padding-top: 20px;
        color:#939da9;
        letter-spacing: 1px;
	  	}
	  }


	}
  .pic{
    width:300px;
    height:280px;
    position: absolute;
	  top: 50%;
	  right: 2%;
	  z-index: 1001;
	  -webkit-transform: translate3d(-50%, -50%, 0);
	  transform: translate3d(-50%, -50%, 0);
    img{
      width:100%;
      height:100%;
    }
  }

}

input::-webkit-input-placeholder {
    color: #d3d7f7;
}
input::-moz-placeholder {   /* Mozilla Firefox 19+ */
    color: #d3d7f7;
}
input:-moz-placeholder {    /* Mozilla Firefox 4 to 18 */
    color: #d3d7f7;
}
input:-ms-input-placeholder {  /* Internet Explorer 10-11 */ 
    color: #d3d7f7;
}


@media screen and (max-width: 800px) {
  .isMobile{
    .login-container{
      .some-space {
        width:100%;
        left:50%;
        .form{
          width:90%;
          margin:0 auto;
        }
      }
      .pic{
        display: none;
      }
    } 
  }
  
}
	
</style>
